package com.th.supcom.pds.impl.service.internal.phamapply.command;

import java.util.List;

import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.th.supcom.pds.domain.pojo.InpPhamApplyDetail;
import com.th.supcom.pds.domain.vo.InpPhamApplyDetailVO;
import com.th.supcom.pds.impl.common.enums.DispenseIndicator;
import com.th.supcom.pds.impl.service.internal.phamapply.PhamDispenseConvertUtils;

/**
 * 更新摆药请领明细
 * 
 * @author leaqua@qq.com
 */
public class UpdateApplyDetail extends AbstractPhamApplyManagerBean implements Command
{

    @Override
    public boolean execute (Context arg0) throws Exception
    {
        PhamDispenseContext context = (PhamDispenseContext) arg0;
        List <InpPhamApplyDetailVO> applyVoList = context.getApplyDetailVOList ();
        for (InpPhamApplyDetailVO inpPhamApplyDetailVO : applyVoList)
        {
            inpPhamApplyDetailVO.setDispenseIndicator (DispenseIndicator.Sorted.getEnumCode ().toString ());
        }
        List <InpPhamApplyDetail> applyList = PhamDispenseConvertUtils.convertVoToAny (applyVoList, InpPhamApplyDetail.class);
        this.getInpPhamApplyDetailBasicService ().modifyInpPhamApplyDetailList (applyList);
        return false;
    }

    /** 日志记录器. */
    public static final Logger s_logger = LoggerFactory.getLogger (UpdateApplyDetail.class);

    /** 公司版权信息. */
    public static final String copyright = "Copyright 2014, TH Supcom Corporation";

    /** 提交路径. */
    public static final String SCC_BRANCH = "$URL$";

    /** 提交日期. */
    public static final String SCC_LAST_MODIFICATION_DATE = "$Date$";

    /** 最终修改人员. */
    public static final String SCC_LAST_MODIFIER_NAME = "$Author$";

    /** 最终版本号. */
    public static final String SCC_REVISION = "$Revision$";
}
